package com.boot.jdk8;

import java.util.Arrays;
import java.util.List;

public class ParallelStream {
    public static void main(String[] args) {
        List<String> tasks= Arrays.asList("1,2,3,4,5,6,7".split(","));
        long t1=System.currentTimeMillis();
        tasks.parallelStream().forEach(e->{
            Thread thread = Thread.currentThread();
            try {
                Thread.sleep(5000l);
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            }
            System.out.println(e+"........"+thread.getId());
        });

        System.out.println("end"+(System.currentTimeMillis()-t1)/1000);
    }
}
